package com.fh.controller;

import com.fh.common.ResultEnum;
import com.fh.common.ResultMessage;
import com.fh.service.UserWalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@CrossOrigin
@RestController
@RequestMapping("userWallet")
public class UserWalletController {
    @Autowired
    private UserWalletService userWalletService;
    @RequestMapping("queryUserAmount")
    public ResultMessage queryUserAmount(Long userId){
        try {
            BigDecimal userAmount= userWalletService.queryUserAmount(userId);
            return new ResultMessage(ResultEnum.QUERY_SUCCESS,userAmount);
        }catch (Exception e){
            e.printStackTrace();
            return new ResultMessage(ResultEnum.QUERY_ERROR);
        }


    }
}
